Skip to content

Fix: Default values bypass min/max validation in utils/validation.get_int/get_float - #1664

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
Kirtan-pc:fix/default-value-bypass
Jul 12, 2026
Merged

Fix: Default values bypass min/max validation in utils/validation.get_int/get_float#1664
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
Kirtan-pc:fix/default-value-bypass

Conversation

@Kirtan-pc

Copy link
Copy Markdown
Contributor

📝 Description

Summary

Fix get_int() and get_float() in utils/validation.py to validate the default parameter against min_value/max_value before returning it. Previously, an out-of-range default (e.g., get_int("Enter: ", min_value=0, max_value=10, default=999)) was returned immediately when the user entered empty input, bypassing range validation and potentially introducing invalid state.

Changes

utils/validation.py

  • get_int(): Before returning the default on empty input, validate it against min_value and max_value. If out of range, print an error message and continue the prompt loop.
  • get_float(): Same fix applied — validate the default against min_value/max_value before returning it on empty input.
    </|DSML|parameter>
    </|DSML|invoke>
    </|DSML|tool_calls>

🔗 Linked Issue

Closes #1545


📋 Contribution Checklist

  • I have verified that my files are placed in the correct directory.
  • I have tested my changes thoroughly on my local machine.
  • GSSoC 2026: I have been formally assigned to this issue and noted it above.

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

@Kirtan-pc is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@steam-bell-92 steam-bell-92 added type:bug Something isn't working level:beginner gssoc:approved GSSoC 2026 approving tag labels Jul 12, 2026
@steam-bell-92
steam-bell-92 merged commit efbdd7c into steam-bell-92:main Jul 12, 2026
0 of 4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.
Thanks again for your support! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC 2026 approving tag level:beginner type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Default values bypass min/max validation in utils/validation.get_int/get_float

2 participants